﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns
{
    /// <summary>
    /// 子系统模块代码   One
    /// </summary>
    public class SubSystemOne
    {
        public string operationOne()
        {
            return "我是One子系统中的模块，你稍等片刻。\n";
        }

        public string operationOneN()
        {
            return "我是One子系统中的N模块，你稍等片刻。\n";
        }
    }

    /// <summary>
    /// 子系统模块代码   Two
    /// </summary>
    public class SubSystemTwo
    {
        public string operationTwo()
        {
            return "我是Two子系统中的模块，你稍等片刻。\n";
        }

        public string operationTwoS()
        {
            return "我是Two子系统中的S模块，你稍等片刻。\n";
        }
    }

    public class FacadePattern
    {
        protected SubSystemOne _one;
        protected SubSystemTwo _two;

        public FacadePattern() : this(new SubSystemOne(), new SubSystemTwo())
        {
        }

        public FacadePattern(SubSystemOne one, SubSystemTwo two)
        {
            _one = one;
            _two = two;
        }

        public string Operation()
        {
            string result = "外观类输出的：\n";
            result += this._one.operationOne();
            result += this._two.operationTwo();
            result += "第二行：\n";
            result += this._one.operationOneN();
            result += this._two.operationTwoS();
            return result;
        }
    }
}
